package com.waitingresult.gateway.config;

import org.springframework.boot.web.embedded.netty.NettyServerCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * All right reserved,Designed By WangShuai
 * <p>
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : NettyServerConfig
 * @Description :
 * @date : 2021/9/16 10:08
 */
@Configuration
public class NettyServerConfig {
    /**
     * netty MaxHeaderSize 默认8k，这里设置大一些，不然数据大了会400
     * https://github.com/spring-cloud/spring-cloud-gateway/issues/481#issuecomment-411433919
     */
    @Bean
    public NettyServerCustomizer serverCustomizer() {
        return options -> options.httpRequestDecoder(spec -> spec.maxHeaderSize(100 * 1024));
    }
}
